<?php

// show off: template
require_once("configuration.php");
require_once("includes/io.php");
require_once("includes/template.php");
require_once("includes/category.php");
require_once("includes/product.php");
require_once("includes/function.php");

// initialization
$template = new template("default");
$categories = "";
$menu_rows = "";
// Categories section
require_once("includes/list.categories.php");
require_once("includes/cart.php");
require_once("includes/function.number.php");
$cart = new customers_cart();
$cart->session_id = $CurrentSession->session_id;
$cart_queries = $cart->get_session_cart();
$cart_edit_rows = "";
$total = 0.00;


while ($obj = $mysql->fo($cart_queries)) {
    $cart = customers_cart::static_set_object($obj);
    $product = product::get_product($cart->product_id);
    $original_price = $product->price;
    if ($product->discount > 0) {
        $discount_price = get_discount_price($product->price, $product->discount);
        $total += $discount_price * $cart->quantity;
        $product->price = "{$discount_price}";
    } else {
        $total += $product->price * $cart->quantity;
    }
    eval("\$cart_edit_rows .= \"" . $template->get("cart.edit.rows") . "\";");
}
eval("\$cart_edit_form = \"" . $template->get("cart.edit.form") . "\";");
// Navigator
require_once("includes/page.php");
require_once("includes/list.menu.php");

// layout
$title = "Shopping cart";


eval("\$header = \"" . $template->get("header") . "\";");
eval("\$body = \"" . $template->get("cart.edit.content") . "\";");
eval("\$footer = \"" . $template->get("footer") . "\";");
eval("\$index = \"" . $template->get("index") . "\";");

// display all
echo ($index); // can use echo $template->compress($index) to compress size of html

require_once("configuration.end.php");
?>